package com.mexico.inloancash.activity;


import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mexico.inloancash.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class IndiaAnswerQuestionsActivity extends BaseActivity {

    @BindView(R.id.logon_back)
    ImageView gonBack;

    @BindView(R.id.title)
    TextView title;

    @BindView(R.id.question1_image)
    ImageView mIndiaIvQuestion1Image;

    @BindView(R.id.question1_linear)
    LinearLayout mIndiaQuestion1Layout;

    @BindView(R.id.question1)
    TextView mIndiaTvquestion;

    @BindView(R.id.question2_image)
    ImageView mIndiaIvQuestion2Image;

    @BindView(R.id.question2_linear)
    LinearLayout mIndiaQuestion2Layout;

    @BindView(R.id.question2)
    TextView mIndiaTvQuestion2;

    @BindView(R.id.question3_image)
    ImageView mIndiaIvQuestion3Image;

    @BindView(R.id.question3_linear)
    LinearLayout mIndiaQuestion3Layout;

    @BindView(R.id.question3)
    TextView mIndiaTvQuestion3;

    @BindView(R.id.question4_image)
    ImageView mIndiaIvQuestion4Image;

    @BindView(R.id.question4_linear)
    LinearLayout mIndiaQuestion4Layout;

    @BindView(R.id.question4)
    TextView mIndiaTvQuestion4;

    @BindView(R.id.question5_image)
    ImageView mIndiaIvQuestion5Image;

    @BindView(R.id.question5_linear)
    LinearLayout mIndiaQuestion5Layout;

    @BindView(R.id.question5)
    TextView mIndiaTvQuestion5;

    @BindView(R.id.question6_image)
    ImageView mIndiaIvQuestion6Image;

    @BindView(R.id.question6_linear)
    LinearLayout mIndiaQuestion6Layout;

    @BindView(R.id.question6)
    TextView mIndiaTvQuestion6;

    private boolean mIndiaIs_Question1 = false;
    private boolean mIndiaIs_Question2 = false;
    private boolean mIndiaIs_Question3 = false;
    private boolean mIndiaIs_Question4 = false;
    private boolean mIndiaIs_Question5 = false;
    private boolean mIndiaIs_Question6 = false;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.india_activity_ques_view_layout);
        ButterKnife.bind(this);
        title.setText(R.string.india_question_s);
        mIndiaTvquestion.setText(R.string.india_question1_ing);
        mIndiaTvQuestion2.setText(R.string.india_question2_ing);
        mIndiaTvQuestion3.setText(R.string.india_question3_ing);
        mIndiaTvQuestion4.setText(R.string.india_question4_ing);
        mIndiaTvQuestion5.setText(R.string.india_question5_ing);
        mIndiaTvQuestion6.setText(R.string.india_question6_ing);
    }

    @OnClick({R.id.logon_back, R.id.question1_linear, R.id.question2_linear, R.id.question3_linear,
            R.id.question4_linear, R.id.question5_linear,R.id.question6_linear})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.logon_back:
                finish();
                break;
            case R.id.question1_linear:
                if (mIndiaIs_Question1) {
                    mIndiaIs_Question1 = false;
                    mIndiaIvQuestion1Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_retract);
                    mIndiaTvquestion.setVisibility(View.GONE);
                } else {
                    mIndiaIs_Question1 = true;
                    mIndiaIvQuestion1Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_open);
                    mIndiaTvquestion.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.question2_linear:
                if (mIndiaIs_Question2) {
                    mIndiaIs_Question2 = false;
                    mIndiaIvQuestion2Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_retract);
                    mIndiaTvQuestion2.setVisibility(View.GONE);
                } else {
                    mIndiaIs_Question2 = true;
                    mIndiaIvQuestion2Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_open);
                    mIndiaTvQuestion2.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.question3_linear:
                if (mIndiaIs_Question3) {
                    mIndiaIs_Question3 = false;
                    mIndiaIvQuestion3Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_retract);
                    mIndiaTvQuestion3.setVisibility(View.GONE);
                } else {
                    mIndiaIs_Question3 = true;
                    mIndiaIvQuestion3Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_open);
                    mIndiaTvQuestion3.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.question4_linear:
                if (mIndiaIs_Question4) {
                    mIndiaIs_Question4 = false;
                    mIndiaIvQuestion4Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_retract);
                    mIndiaTvQuestion4.setVisibility(View.GONE);
                } else {
                    mIndiaIs_Question4 = true;
                    mIndiaIvQuestion4Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_open);
                    mIndiaTvQuestion4.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.question5_linear:
                if (mIndiaIs_Question5) {
                    mIndiaIs_Question5 = false;
                    mIndiaIvQuestion5Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_retract);
                    mIndiaTvQuestion5.setVisibility(View.GONE);
                } else {
                    mIndiaIs_Question5 = true;
                    mIndiaIvQuestion5Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_open);
                    mIndiaTvQuestion5.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.question6_linear:
                if (mIndiaIs_Question6) {
                    mIndiaIs_Question6 = false;
                    mIndiaIvQuestion6Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_retract);
                    mIndiaTvQuestion6.setVisibility(View.GONE);
                } else {
                    mIndiaIs_Question6 = true;
                    mIndiaIvQuestion6Image.setImageResource(R.mipmap.india_layanan_picture_pelanggan_icon_open);
                    mIndiaTvQuestion6.setVisibility(View.VISIBLE);
                }
                break;
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            finish();
        }
        return super.onKeyDown(keyCode, event);
    }
}
